package mutilcore;

import java.util.Calendar;
import java.util.List;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;

import util.Tools;

public class StatisName {

    public static void main(String[] args) throws Exception {
        String path = System.getProperty("user.dir");
        List<String> nameList = Tools.readFile(path
                + "/src/testFile/hlm/hongloumeng.txt");
        long startTime = Calendar.getInstance().getTimeInMillis();
        ForkJoinPool forkJoinPool = new ForkJoinPool();
        forkJoinPool.submit(new StatisNameTask(nameList));
        // 等待超时参数为1秒，转换为毫秒为1000，所以后面计算时间时，需要减去1000毫秒
        forkJoinPool.awaitTermination(1, TimeUnit.SECONDS);
        long endTime = Calendar.getInstance().getTimeInMillis();
        System.out.println(Tools.userName.toString());
        System.out.println("开始时间: " + startTime);
        System.out.println("结束时间: " + endTime);
        System.out.println("使用时间(毫秒数)：" + (endTime - startTime - 1000));
    }
}
